package domain.entities;// default package

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Regions entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "regions", catalog = "bms")
public class Regions implements java.io.Serializable, Comparable<Regions>  {

	// Fields

	private Short regionId;
	private Short countryId;
	private String region;
	private String code;
	private String adm1code;

	// Constructors

	/** default constructor */
	public Regions() {
	}

	/** minimal constructor */
	public Regions(Short countries, String region, String code,
			String adm1code) {
		this.countryId = countries;
		this.region = region;
		this.code = code;
		this.adm1code = adm1code;
	}

	/** full constructor */
	public Regions(Short countries, String region, String code,
			String adm1code, Set<Cities> citieses) {
		this.countryId = countries;
		this.region = region;
		this.code = code;
		this.adm1code = adm1code;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "RegionID", unique = true, nullable = false)
	public Short getRegionId() {
		return this.regionId;
	}

	public void setRegionId(Short regionId) {
		this.regionId = regionId;
	}

	@Column(name = "CountryID")
	public Short getCountries() {
		return this.countryId;
	}

	public void setCountries(Short countries) {
		this.countryId = countries;
	}

	@Column(name = "Region", nullable = false, length = 45)
	public String getRegion() {
		return this.region;
	}

	public void setRegion(String region) {
		this.region = region;
	}

	@Column(name = "Code",length = 8)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "ADM1Code", length = 4)
	public String getAdm1code() {
		return this.adm1code;
	}

	public void setAdm1code(String adm1code) {
		this.adm1code = adm1code;
	}

    @Override
    public int compareTo(Regions o) {
        return this.region.toLowerCase().compareTo(o.getRegion().toLowerCase());
    }
}